package com.bbva.kyfb.kyfbjpatlsb.dominiotlsb;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Embeddable;

import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.roo.addon.entity.RooIdentifier;

import flexjson.JSONDeserializer;
import flexjson.JSONSerializer;

/**
 * The Class TbdbzbitPK.
 */
@Embeddable
@Configurable
@RooIdentifier(dbManaged = true)
public final class TbdbzbitPK implements java.io.Serializable, org.springframework.beans.factory.aspectj.ConfigurableObject{

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = 1L;

	/** The cod canaldi. */
	@Column(name = "COD_CANALDI", nullable = false,columnDefinition = "SMALLINT")
    private Short codCanaldi;

	/** The cod bancoint. */
	@Column(name = "COD_BANCOINT", nullable = false,columnDefinition = "SMALLINT")
    private Short codBancoint;

	/** The cod logonapl. */
	@Column(name = "COD_LOGONAPL", nullable = false,columnDefinition = "CHAR", length = 20)
    private String codLogonapl;

	/** The xti buzon. */
	@Column(name = "XTI_BUZON", nullable = false,columnDefinition = "CHAR")
    private Character xtiBuzon;

	/** The qnu numitem. */
	@Column(name = "QNU_NUMITEM", nullable = false,columnDefinition = "DECIMAL")
    private BigDecimal qnuNumitem;

	/**
	 * Instantiates a new tbdbzbit pk.
	 *
	 * @param codCanaldi the cod canaldi
	 * @param codBancoint the cod bancoint
	 * @param codLogonapl the cod logonapl
	 * @param xtiBuzon the xti buzon
	 * @param qnuNumitem the qnu numitem
	 */
	public TbdbzbitPK(Short codCanaldi, Short codBancoint, String codLogonapl, Character xtiBuzon, BigDecimal qnuNumitem) {
        super();
        this.codCanaldi = codCanaldi;
        this.codBancoint = codBancoint;
        this.codLogonapl = codLogonapl;
        this.xtiBuzon = xtiBuzon;
        this.qnuNumitem = qnuNumitem;
    }

	/**
	 * Instantiates a new tbdbzbit pk.
	 */
	@SuppressWarnings("unused")
	private TbdbzbitPK() {
        super();
    }

	/**
	 * Gets the cod canaldi.
	 *
	 * @return the cod canaldi
	 */
	public Short getCodCanaldi() {
        return this.codCanaldi;
    }

	/**
	 * Gets the cod bancoint.
	 *
	 * @return the cod bancoint
	 */
	public Short getCodBancoint() {
        return this.codBancoint;
    }

	/**
	 * Gets the cod logonapl.
	 *
	 * @return the cod logonapl
	 */
	public String getCodLogonapl() {
        return this.codLogonapl;
    }

	/**
	 * Gets the xti buzon.
	 *
	 * @return the xti buzon
	 */
	public Character getXtiBuzon() {
        return this.xtiBuzon;
    }

	/**
	 * Gets the qnu numitem.
	 *
	 * @return the qnu numitem
	 */
	public BigDecimal getQnuNumitem() {
        return this.qnuNumitem;
    }

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null) return false;
        if (!(obj instanceof TbdbzbitPK)) return false;
        TbdbzbitPK other = (TbdbzbitPK) obj;
        if (codCanaldi == null) {
            if (other.codCanaldi != null) return false;
        } else if (!codCanaldi.equals(other.codCanaldi)) return false;
        if (codBancoint == null) {
            if (other.codBancoint != null) return false;
        } else if (!codBancoint.equals(other.codBancoint)) return false;
        if (codLogonapl == null) {
            if (other.codLogonapl != null) return false;
        } else if (!codLogonapl.equals(other.codLogonapl)) return false;
        if (xtiBuzon == null) {
            if (other.xtiBuzon != null) return false;
        } else if (!xtiBuzon.equals(other.xtiBuzon)) return false;
        if (qnuNumitem == null) {
            if (other.qnuNumitem != null) return false;
        } else if (!qnuNumitem.equals(other.qnuNumitem)) return false;
        return true;
    }

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
        final int prime = 31;
        int result = 17;
        result = prime * result + (codCanaldi == null ? 0 : codCanaldi.hashCode());
        result = prime * result + (codBancoint == null ? 0 : codBancoint.hashCode());
        result = prime * result + (codLogonapl == null ? 0 : codLogonapl.hashCode());
        result = prime * result + (xtiBuzon == null ? 0 : xtiBuzon.hashCode());
        result = prime * result + (qnuNumitem == null ? 0 : qnuNumitem.hashCode());
        return result;
    }

	/**
	 * To json.
	 *
	 * @return the string
	 */
	public String toJson() {
        return new JSONSerializer().exclude("*.class").serialize(this);
    }

	/**
	 * From json to tbdbzbit pk.
	 *
	 * @param json the json
	 * @return the tbdbzbit pk
	 */
	public static TbdbzbitPK fromJsonToTbdbzbitPK(String json) {
        return new JSONDeserializer<TbdbzbitPK>().use(null, TbdbzbitPK.class).deserialize(json);
    }

	/**
	 * To json array.
	 *
	 * @param collection the collection
	 * @return the string
	 */
	public static String toJsonArray(Collection<TbdbzbitPK> collection) {
        return new JSONSerializer().exclude("*.class").serialize(collection);
    }

	/**
	 * From json array to tbdbzbit p ks.
	 *
	 * @param json the json
	 * @return the collection
	 */
	public static Collection<TbdbzbitPK> fromJsonArrayToTbdbzbitPKs(String json) {
        return new JSONDeserializer<List<TbdbzbitPK>>().use(null, ArrayList.class).use("values", TbdbzbitPK.class).deserialize(json);
    }
}
